//用于编辑测试需求的表单
var testRequirementEditorForm = Ext.create("Ext.form.Panel", {
    border: false,
    id: 'testRequirementEditorForm',
    title: '编辑测试需求',
    hidden: true,
    bodyPadding: 10,
    defaults: {
        anchor: '100%',
        layout: 'column', //默认定义组件内部元素为布局为列布局方式
        border: false,
        margin: '20 0 0 0'
    },
    items: [{
        margin: '0 0 0 0',
        defaults: {
            border: false,
            layout: 'form'
        },
        items: [{
            columnWidth: .5, //该列占用的宽度，标识为50％
            items: [{
                xtype: 'textfield',
                maxLength: fieldWordLimited,
                labelWidth: 50,
                allowBlank: false,
                fieldLabel: '标题',
                name: 'title',
                emptyText: '限制字数' + fieldWordLimited,
                itemId: 'testRequirementFormTitle'
            }]
        }, {
            columnWidth: .5,
            items: [{
                xtype: 'displayfield',
                labelWidth: 30,
                fieldLabel: '状态',
                itemId: 'testRequirementFormState'
            }]
        }]
    }, {
        defaults: {
            border: false,
            layout: 'form'
        },
        items: [{
            columnWidth: .5, //该列占用的宽度，标识为50％
            items: [{
                xtype: 'displayfield',
                labelWidth: 50,
                fieldLabel: '编写者',
                itemId: 'testRequirementFormAuthor'
            }]
        }, {
            columnWidth: .15,
            items: [{
                xtype: 'displayfield',
                fieldLabel: '审核次数',
                labelWidth: 50,
                itemId: 'testRequirementFormCheckTime'
            }]
        },
            {
                columnWidth: .35,
                items: [{
                    xtype: 'button',
                    text: '查看',
                    itemId: 'testRequirementFormCheckButton',
                    //hidden:true,
                    listeners: [{
                        click: function () {
                            var selectArray = testRequirementLeftTree.getSelectionModel().getSelected();// 得到被选择的行的数组.
                            testRequirementCheckLogStore.proxy.url = zuulUrl + '/' + testServiceName + '/testRequirementCheck/common/' + selectArray.items[0].data.id;
                            testRequirementCheckLogStore.reload();
                            testRequirementCheckLogWin.setTitle('查看审核记录');
                            testRequirementCheckLogWin.removeAll(false);
                            testRequirementCheckLogWin.add(testRequirementCheckLogGrid);
                            testRequirementCheckLogWin.show();
                        }
                    }]
                }]
            }
        ]
    }, {
        defaults: {
            border: false,
            layout: 'form'
        },
        items: [{
            columnWidth: .5, //该列占用的宽度，标识为50％
            items: [{
                xtype: 'displayfield',
                fieldLabel: '创建时间:',
                //formatText:'date("Y-m-d H:i:s")',
                labelWidth: 70,
                itemId: 'testRequirementFormCreateDate'
            }]
        }, {
            columnWidth: .5,
            items: [{
                xtype: 'displayfield',
                fieldLabel: '最近更新:',
                //formatText:'date("Y-m-d H:i:s")',
                labelWidth: 70,
                itemId: 'testRequirementFormUpdateDate'
            }]
        }]
    }, {
        layout: 'fit',
        items: [testRequirementEditorIFrame],
        height: 350
    }],
    buttons: [{
        text: '保存并提交',
        itemId: 'testRequirementFormCommitButton',
        handler: function () {
            var item = testRequirementLeftTree.getSelectionModel().getSelected();// 得到被选择的行的数组.
            testRequirementFormSubmit(item, 1);
        }
    }, {
        text: '保存',
        itemId: 'testRequirementFormSaveButton',
        handler: function () {
            var item = testRequirementLeftTree.getSelectionModel().getSelected();// 得到被选择的行的数组.
            testRequirementFormSubmit(item, 0);
        }
    }]
});

//用于测试需求转换成测试计划是提供主题、优先级选择的表单
var testRequirementTransformToDesignForm = Ext.create("Ext.form.Panel", {
    border: false,
    id: 'testRequirementTransformToDesignForm',
    title: false,
    bodyPadding: '10 20',
    defaults: {
        anchor: '98%',
        msgTarget: 'side',
        allowBlank: false
    },
    items: [
        chooserDesignSbjectTreePicker, {
            xtype: 'combo',
            fieldLabel: '优先级',
            allowBlank: false,
            labelWidth: 50,
            editable: false,//防止用户直接在下拉框里输入
            itemId: 'testReqToDesignPriority',
            emptyText: '选择计划优先级',
            store: priorityStore,
            queryMode: 'local',
            displayField: 'priorityName',
            valueField: 'priorityNum',
        }, {
            xtype: 'textfield',
            labelWidth: 50,
            allowBlank: false,
            fieldLabel: '名称',
            emptyText: '请输入名称',
            itemId: 'testReqToDesignTitle'
        }, {
            fieldLabel: '是否转换成<br>测试步骤',
            columns: [100, 100],
            labelWidth: 80,
            xtype: 'radiogroup',
            itemId: 'testReqToDesignisIsIncludeChildren',
            items: [{boxLabel: '是', name: 'isIncludeStep', inputValue: 1}, {
                boxLabel: '否',
                checked: true,
                name: 'isIncludeStep',
                inputValue: 0
            }]
        }]
});